Skip to content

Fix three --apply failures found on real Proxmox hosts - #18

Merged
modem7 merged 1 commit into
masterfrom
fix-real-world-apply-failures
Jul 31, 2026
Merged

Fix three --apply failures found on real Proxmox hosts#18
modem7 merged 1 commit into
masterfrom
fix-real-world-apply-failures

Conversation

@modem7

@modem7 modem7 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes three bugs surfaced by running curl | sudo bash -s -- --apply against real hosts (frodo, samwise, pbs — all Debian 13 trixie / Proxmox):

  1. apt purge -y zram-config → "Unable to locate package" (frodo). Happened even though zram was genuinely active — apt's package index doesn't cover the package on this system (not every distro carries zram-config in its default repos). This aborted the whole run under set -e, mid-migration: zram was already swapped off and the service disabled, but zswap was never enabled. Fixed by falling back to dpkg --purge, and no longer treating purge failure as fatal — package cleanup isn't load-bearing for the actual swap-behavior change.
  2. Writing zpool=zsmalloc → "Permission denied" as root (samwise, pbs). Consistent with kernel lockdown (Secure Boot) blocking the sysfs write's implicit request_module(). Fixed by explicitly modprobe zsmalloc first, and making runtime-enable failures non-fatal — the kernel cmdline still gets persisted either way, so zswap comes up correctly after a reboot even if it couldn't go live immediately.
  3. Revert hint printed sudo $0 --revert --apply, which is sudo bash --revert --apply when run via curl | sudo bash -s -- — not runnable. Now detects the piped case and prints a working curl | sudo bash -s -- --revert --apply one-liner instead.

Test plan

  • bash -n syntax check passes
  • Root-caused all three from actual failure output pasted from frodo/samwise/pbs
  • Not yet re-verified end-to-end on the affected hosts, or on the disposable test VM (unreachable — "No route to host" — at time of this PR)

- zram-config purge: apt can report "Unable to locate package" even
  when it's genuinely installed (index doesn't cover it, e.g. Debian
  trixie without the repo that provided it). Fall back to dpkg --purge,
  and don't abort the whole run if package cleanup fails — the swap
  state change is what actually matters.
- zswap runtime enable: writing zpool=zsmalloc got "Permission denied"
  as root on two Proxmox hosts, consistent with kernel lockdown (Secure
  Boot) blocking the sysfs write's implicit request_module(). Now
  modprobe zsmalloc explicitly first, and treat runtime-enable failure
  as non-fatal (the kernel cmdline is still persisted, so zswap comes
  up correctly after a reboot either way).
- Revert hint printed $0, which is just "bash" when run via
  `curl | sudo bash -s -- --apply` — not something you can rerun.
  Detect that case and print a working curl-and-pipe one-liner instead.

frodo's first --apply run aborted mid-migration on the apt purge bug
(zram swapoff'd and service disabled, but zswap never got enabled).
Re-running the fixed script picks up cleanly from there since state
detection is based on live swapon/sysfs state, not a resume marker.
@modem7
modem7 merged commit 27e3b34 into master Jul 31, 2026
3 checks passed
@modem7
modem7 deleted the fix-real-world-apply-failures branch July 31, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant